Skip to content

fix(widget): add liquid_staking yield type support#543

Merged
petar-omni merged 1 commit into
mainfrom
fix/liquid-staking-type
Jun 24, 2026
Merged

fix(widget): add liquid_staking yield type support#543
petar-omni merged 1 commit into
mainfrom
fix/liquid-staking-type

Conversation

@petar-omni

@petar-omni petar-omni commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Map liquid_staking to the stake dashboard category and treat unknown future API yield types as "unknown" so filters and labels stay safe when the server adds types before the widget is updated.

Summary by CodeRabbit

  • New Features
    • Added support for the liquid_staking yield type across the widget, including dashboard grouping, labels, and yield metadata.
    • Added underscore-based translation entries (EN/FR) and updated staking/unstaking/position wording accordingly.
  • Bug Fixes
    • Improved runtime handling so unrecognized yield types show consistent “unknown” labels and category behavior (instead of raw/unmapped values).
  • Tests
    • Expanded test coverage for dashboard category mapping, sort ranking, label generation, and stake activity filters to include liquid_staking and “unknown.”

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f3d1dfa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1643a4db-9735-4022-9355-298d8546e3cf

📥 Commits

Reviewing files that changed from the base of the PR and between 321fe16 and f3d1dfa.

⛔ Files ignored due to path filters (2)
  • packages/widget/src/generated/api/legacy.ts is excluded by !**/generated/**
  • packages/widget/src/generated/api/yield.ts is excluded by !**/generated/**
📒 Files selected for processing (6)
  • packages/widget/src/domain/types/yields.ts
  • packages/widget/src/hooks/use-yield-meta-info.tsx
  • packages/widget/src/translation/English/translations.json
  • packages/widget/src/translation/French/translations.json
  • packages/widget/tests/domain/dashboard-yield-category-types.test.ts
  • packages/widget/tests/hooks/activity-actions.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/widget/src/translation/French/translations.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/widget/tests/hooks/activity-actions.test.ts
  • packages/widget/tests/domain/dashboard-yield-category-types.test.ts
  • packages/widget/src/hooks/use-yield-meta-info.tsx
  • packages/widget/src/domain/types/yields.ts
  • packages/widget/src/translation/English/translations.json

📝 Walkthrough

Walkthrough

Adds liquid_staking as a known yield type and introduces an "unknown" fallback for unrecognized API yield types. The change updates domain typing, dashboard mapping, labels, sort ranking, hook routing, translations, and tests.

Changes

liquid_staking and unknown yield type support

Layer / File(s) Summary
Known yield type contracts and unknown fallback
packages/widget/src/domain/types/yields.ts
Adds knownApiYieldTypes, derives KnownApiYieldType and KnownExtendedYieldType, redefines ExtendedYieldType as KnownExtendedYieldType | "unknown", narrows getApiYieldTypesForDashboardCategory, and adds a runtime type guard so getExtendedYieldType returns "unknown" for unrecognized API types.
Dashboard category mapping and yield labels
packages/widget/src/domain/types/yields.ts
Adds liquid_staking to the stake dashboard category, treats it as staking, extends yield labels for liquid_staking, adds an "unknown" label, and updates sort-rank values for both new types.
Hook switch-case routing for liquid_staking
packages/widget/src/hooks/use-yield-meta-info.tsx
Adds case "liquid_staking" so it follows the staking metadata path.
English and French translation keys
packages/widget/src/translation/English/translations.json, packages/widget/src/translation/French/translations.json
Adds underscore-keyed liquid_staking entries, plus liquidity_pool and unknown fallback labels, across completion messages, yield_types, and position_details.
Domain and hook test coverage
packages/widget/tests/domain/dashboard-yield-category-types.test.ts, packages/widget/tests/hooks/activity-actions.test.ts
Adds liquid_staking to test fixtures, verifies unknown runtime yield types, and updates stake filter expectations to include liquid_staking.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • stakekit/widget#527: Directly modifies getApiYieldTypesForDashboardCategory in yields.ts, the same function this PR narrows to known API yield types.
  • stakekit/widget#541: Uses getApiYieldTypesForDashboardCategory to filter eligible tokens by dashboard category, so its behavior depends on the mapping changes here.
  • stakekit/widget#542: Builds activity filters from dashboard category yield types, which are expanded here to include liquid_staking.

Suggested reviewers

  • Philippoes
  • raiseerco
  • dnehl

Poem

🐇 Hop-hop, the yield types sing,
liquid_staking joins the spring.
"unknown" waits when types roam free,
Labels, ranks, and texts agree.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is on-topic but does not use the required Added/Changed template sections and omits most requested detail. Expand it into the repo template with separate Added and Changed sections summarizing the liquid_staking mapping and unknown-yield fallback.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately highlights the main change: adding liquid_staking yield type support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/liquid-staking-type

Comment @coderabbitai help to get the list of available commands.

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-543.df4xyoi0xyeak.amplifyapp.com

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-543.d2ribjy8evqo6h.amplifyapp.com

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/widget/src/domain/types/yields.ts`:
- Around line 452-457: The unknown yield fallback in the yield type mapping is
hardcoded with user-facing English copy, so localize it the same way as the
other entries in the yields type definitions. Update the `unknown` object in
`yields.ts` to use translation keys instead of literal `"Yield"` and `"Earn"`
values, and add the corresponding keys and values in both
`packages/widget/src/translation/English/translations.json` and
`packages/widget/src/translation/French/translations.json`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c1ca82f-9f4a-49d4-9a61-0d7e15f310c2

📥 Commits

Reviewing files that changed from the base of the PR and between 660ad89 and 321fe16.

⛔ Files ignored due to path filters (2)
  • packages/widget/src/generated/api/legacy.ts is excluded by !**/generated/**
  • packages/widget/src/generated/api/yield.ts is excluded by !**/generated/**
📒 Files selected for processing (6)
  • packages/widget/src/domain/types/yields.ts
  • packages/widget/src/hooks/use-yield-meta-info.tsx
  • packages/widget/src/translation/English/translations.json
  • packages/widget/src/translation/French/translations.json
  • packages/widget/tests/domain/dashboard-yield-category-types.test.ts
  • packages/widget/tests/hooks/activity-actions.test.ts

Comment on lines +452 to +457
unknown: {
type: "unknown",
title: "Yield",
review: "Earn",
cta: "Earn",
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Localize the "unknown" fallback labels.

These strings are user-facing, but hardcoding "Yield" / "Earn" bypasses i18n and will show English copy in non-English locales whenever the API returns a future unknown type. Use translation keys here the same way the other yield types do.

As per coding guidelines, "When changing user-facing copy, update both packages/widget/src/translation/English/translations.json and packages/widget/src/translation/French/translations.json".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/widget/src/domain/types/yields.ts` around lines 452 - 457, The
unknown yield fallback in the yield type mapping is hardcoded with user-facing
English copy, so localize it the same way as the other entries in the yields
type definitions. Update the `unknown` object in `yields.ts` to use translation
keys instead of literal `"Yield"` and `"Earn"` values, and add the corresponding
keys and values in both
`packages/widget/src/translation/English/translations.json` and
`packages/widget/src/translation/French/translations.json`.

Source: Coding guidelines

Map liquid_staking to the stake dashboard category and treat unknown
future API yield types as "unknown" so filters and labels stay safe
when the server adds types before the widget is updated.
@petar-omni petar-omni force-pushed the fix/liquid-staking-type branch from 321fe16 to f3d1dfa Compare June 24, 2026 09:47
@petar-omni petar-omni merged commit 8178593 into main Jun 24, 2026
8 checks passed
@petar-omni petar-omni deleted the fix/liquid-staking-type branch June 24, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants